//
//  FinishOrderDetailInfoTableViewCell.m
//  rrqs
//
//  Created by mac book on 2019/5/5.
//

#import "FinishOrderDetailInfoTableViewCell.h"

@interface FinishOrderDetailInfoTableViewCell ()

@property(nonatomic,strong) UILabel* nameLabel;

@property(nonatomic,strong) UILabel* priceLabel;

@property(nonatomic,strong) UILabel* countLabel;


@end


@implementation FinishOrderDetailInfoTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        [self createSubviews];
        
    }
    return self;
}

#pragma mark - createSubviews
-(void)createSubviews{
    
    
    
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.priceLabel];
    [self.contentView addSubview:self.countLabel];


    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.bottom.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(15);
        make.height.mas_equalTo(25);
        make.width.equalTo(self.contentView.mas_width).multipliedBy(0.4);

    }];
    
    
    [self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.height.equalTo(self.nameLabel);
        make.left.equalTo(self.nameLabel.mas_right);
        make.width.equalTo(self.contentView.mas_width).multipliedBy(0.2);

    }];
    
    [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.height.equalTo(self.nameLabel);
        make.left.equalTo(self.countLabel.mas_right);
        make.right.equalTo(self.contentView).offset(-15);
        
    }];
    
    
    
    
    

}


-(void)setEntity:(MOrder *)entity{
    
    
    _entity = entity;
    
    self.nameLabel.text = [NSString stringWithFormat:@"%@",entity.fname];
    self.countLabel.text = [NSString stringWithFormat:@"☓%@",entity.quantity];

    self.priceLabel.text = [NSString stringWithFormat:@"￥%@",entity.price];

}



-(UILabel *)nameLabel{
    if(!_nameLabel){
        _nameLabel = [[UILabel alloc]init];
//        _nameLabel.textColor =kMyColor(130, 130, 130);
        _nameLabel.font = kFontNameSize(13);
    }
    return _nameLabel;
}




-(UILabel *)priceLabel{
    if(!_priceLabel){
        _priceLabel = [[UILabel alloc]init];
//        _priceLabel.textColor =kMyColor(130, 130, 130);
        _priceLabel.font = kFontNameSize(13);
        _priceLabel.textAlignment = NSTextAlignmentRight;
    }
    return _priceLabel;
}

-(UILabel *)countLabel{
    if(!_countLabel){
        _countLabel = [[UILabel alloc]init];
//        _countLabel.textColor =kMyColor(130, 130, 130);
        _countLabel.font = kFontNameSize(13);
        _countLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _countLabel;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
